package simple;

class Solution70 {
    public int climbStairs(int n) {

        if(n <= 3) return n;

        //尝试滚动更新，变量前两位(n=4)
        int x_1 = 3,x_2= 2;

        for(int i = 4;i <= n;i++){
            //局部临时变量x
            int x = x_1 + x_2;
            //变量前移
            x_2 = x_1;
            x_1 = x;//此时x_1前移，就是答案

        }

        return x_1;
    }
}